VERSION 5.00
Begin VB.UserControl TouchYearSelector 
   BackColor       =   &H00FFFFFF&
   ClientHeight    =   4065
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   3570
   ScaleHeight     =   4065
   ScaleWidth      =   3570
   Begin VB.CommandButton Command1 
      BackColor       =   &H80000016&
      Caption         =   "9"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Index           =   9
      Left            =   2640
      Style           =   1  'Graphical
      TabIndex        =   9
      Top             =   2160
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H80000016&
      Caption         =   "8"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Index           =   8
      Left            =   1320
      Style           =   1  'Graphical
      TabIndex        =   8
      Top             =   2160
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H80000016&
      Caption         =   "7"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Index           =   7
      Left            =   0
      Style           =   1  'Graphical
      TabIndex        =   7
      Top             =   2160
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H80000016&
      Caption         =   "6"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Index           =   6
      Left            =   2640
      Style           =   1  'Graphical
      TabIndex        =   6
      Top             =   1080
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H80000016&
      Caption         =   "5"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Index           =   5
      Left            =   1320
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   1080
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H80000016&
      Caption         =   "4"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Index           =   4
      Left            =   0
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   1080
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H80000016&
      Caption         =   "3"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Index           =   3
      Left            =   2640
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   0
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H80000016&
      Caption         =   "2"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Index           =   2
      Left            =   1320
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   0
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H80000016&
      Caption         =   "1"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Index           =   1
      Left            =   0
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   0
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H80000016&
      Caption         =   "0"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Index           =   0
      Left            =   1320
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   3240
      Width           =   855
   End
End
Attribute VB_Name = "TouchYearSelector"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Public Event SelectionMade()
Public Event KeyPressed()
Dim Year_Chosen As String
Dim CurrYear As Integer

Private Sub Command1_Click(Index As Integer)
   Year_Chosen = Year_Chosen + TrimStr(Index)
   If Len(Year_Chosen) = 1 Then
      If Year_Chosen = "1" Then
         For I = 0 To 8
            Command1(I).Enabled = False
         Next I
         Command1(9).Enabled = True
      Else
         'must be a 2
         Command1(0).Enabled = True
         For I = 1 To 9
            Command1(I).Enabled = False
         Next I
      End If
   End If
   If Len(Year_Chosen) = 2 Then
      If Year_Chosen = "19" Then
         For I = 0 To 2
            Command1(I).Enabled = False
         Next I
         For I = 3 To 9
            Command1(I).Enabled = True
         Next I
      End If
   End If
   If Len(Year_Chosen) = 3 Then
      If Left(Year_Chosen, 2) = "19" Then
         For I = 0 To 9
            Command1(I).Enabled = True
         Next I
      Else
         For I = 0 To CurrYear
            Command1(I).Enabled = True
         Next I
         For I = CurrYear + 1 To 9
            Command1(I).Enabled = False
         Next I
      End If
   End If
   If Len(Year_Chosen) >= 4 Then
      For I = 0 To 9
         Command1(I).Enabled = False
      Next I
      RaiseEvent SelectionMade
   Else
      RaiseEvent KeyPressed
   End If
End Sub

Private Sub UserControl_Initialize()
   Year_Chosen = ""
   Command1(0).Enabled = False
   Command1(1).Enabled = True
   Command1(2).Enabled = True
   For I = 3 To 9
      Command1(I).Enabled = False
   Next I
   CurrYear = Val(Right(Year(Now()), 1))
End Sub

Property Get Year_Selected() As String
   Year_Selected = Year_Chosen
End Property

Public Function ResetControl()
   UserControl_Initialize
End Function

Property Let Enabled(ByVal EnabledStatus As Boolean)
  For I = 0 To 9
  Command1(I).Enabled = EnabledStatus
  Next I
End Property

